#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
int main()
{
	int arr[12][12] = { 0 };
	int i = 0;
	int j = 0;
	int n = 0, flag = 1;
	cin >> n;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n; j++)
		{
			cin >> arr[i][j];
		}
	}
	for (i = 1; i < n; i++)
	{
		for (j = 0; j < i; j++)
		{
			if (arr[i][j] != 0)
				flag = 0;
		}
	}
	if (flag) cout << "YES" << endl;
	else cout << "NO" << endl;
}